cmake_minimum_required(VERSION 3.8)
project(behavior_tree)

# Default to C++14
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include/CMakeModules)

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(lifecycle_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(test_interfaces REQUIRED)
find_package(test_utils REQUIRED)
find_package(BehaviorTreeCPP REQUIRED)

include_directories(
  include
  ${BehaviorTree_INCLUDE_DIRS}
)

add_executable(simple_tree 
  src/simple_tree.cpp
)
target_link_libraries(simple_tree BehaviorTree::BehaviorTree)
ament_target_dependencies(simple_tree rclcpp std_msgs test_interfaces)

add_executable(simple_tree_ros 
  src/simple_tree_ros.cpp
)
target_link_libraries(simple_tree_ros BehaviorTree::BehaviorTree)
ament_target_dependencies(simple_tree_ros rclcpp std_msgs test_interfaces)

add_executable(simple_tree_lifecycle
  src/simple_tree_node.cpp
)
target_link_libraries(simple_tree_lifecycle BehaviorTree::BehaviorTree)
ament_target_dependencies(simple_tree_lifecycle rclcpp rclcpp_lifecycle lifecycle_msgs std_msgs test_interfaces test_utils)

add_executable(ask_bt_client
  test/ask_bt_client.cpp
)
ament_target_dependencies(ask_bt_client rclcpp std_msgs test_interfaces test_utils)

install(
  TARGETS simple_tree simple_tree_ros simple_tree_lifecycle ask_bt_client
  DESTINATION lib/${PROJECT_NAME}/
)

ament_package()
